package com.summer.data.dialect.oracle;

/**
 * @author 345480567@qq.com
 */
public class OracleDialect_9i extends OracleDialect {
    @Override
    public String getPageSql(String sql, Integer offset, Integer pageSize) {

        StringBuilder fmt = new StringBuilder();
        fmt.append("SELECT * FROM ( ");
        fmt.append(" SELECT TMP_PAGE.*, ROWNUM SD_ROW_ID FROM ( %s ) TMP_PAGE WHERE SD_ROW_ID <= %d");
        fmt.append(") WHERE SD_ROW_ID > %d ");

        String pageSql = String.format(fmt.toString(), sql, offset+pageSize, offset);
        return pageSql;
    }

}
